package kr.hkit.powerjava.chapter14;

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.HeadlessException;

import javax.swing.JFrame;

class MyFrame extends JFrame{

	public MyFrame(String title) throws HeadlessException {
		super(title);
		init();
	}

	private void init() {
		setSize(450, 300);//레이아웃의 사이즈 설정
		setLayout(new BorderLayout(30,30));//30 gap//보더레이아웃을 세팅
		add(new Button("Center"),BorderLayout.CENTER);//각버튼의이름과 위치 설정
		add(new Button("Page start"),BorderLayout.NORTH);
		add(new Button("Page End"),BorderLayout.PAGE_END);
		add(new Button("Line Start"),BorderLayout.LINE_START);
		add(new Button("Line End"),BorderLayout.LINE_END);
		
		/*BorderLayout layout=(BorderLayout) getLayout();
		layout.setVgap(30);
		layout.setHgap(30);*/
		setVisible(true);
		
	}
	
}

public class BorderLayoutEx {
	public static void main(String[] args) {
		new MyFrame("BorderLayout 예제");
	}
}
